﻿using ActorSystem;
using System;
using System.Threading;

namespace ActorSystem_.Tests
{
    public class Game
    {
        public static void Main()
        {
            var world = new Scene();
            world.AddActor(new Player());
            while (true)
            {
                Thread.Sleep(17);
                world.Update();
            }
        }
    }

    public class Player : NormalActor
    {
        public override void OnStart()
        {
            AddSkill(new Skill01()
            {
                Name = "普通攻击",
                Self = this,
                Radius = 2f,
                Buff = new NormalDamageBuff()
                {
                    Damage = 10,
                }
            });
        }

        public override void OnUpdate()
        {
            base.OnUpdate();
            if (Console.ReadKey().Key == ConsoleKey.X)
            {
                UseSkill(0);
            }
        }
    }

    public class Enemy : NormalActor
    {
        public override void OnStart()
        {
            AddSkill(new Skill01()
            {
                Name = "普通攻击",
                Self = this,
                Radius = 2f,
                Buff = new NormalDamageBuff()
                {
                    Damage = 10,
                }
            });
        }

        public override void OnUpdate()
        {
            base.OnUpdate();
        }

        public override void Damage(NormalActor target, NormalBuffBase damageBuff)
        {
            base.Damage(target, damageBuff);
            Console.WriteLine($"{Name}受到了{damageBuff.Self.Name}的攻击，剩余生命值{Property.Health}");
        }
    }
}
